package com.novax.ex.activity.open.api.inner;

import com.novax.ex.activity.open.model.request.task.TaskTemplateLanguageRequest;
import com.novax.ex.activity.open.model.request.task.TaskTemplateRequest;
import com.novax.ex.activity.open.model.response.task.TaskTemplateLanguageResponse;
import com.novax.ex.activity.open.model.response.task.TaskTemplateResponse;
import com.novax.ex.common.results.ReturnResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

import jakarta.validation.Valid;
import java.util.List;

/**
 * @Description 后台 任务模板配置API
 * @Author ChenXi
 * @Date 2023/06/25/11:49
 */

@Tag(name = "后台 新手引导任务模板配置", description = "后台 新手引导任务模板配置")
@FeignClient(url = "${remote.activity-service.endpoint}", name = "TaskTemplateApi", contextId = "TaskTemplateApi")
public interface TaskTemplateApi {

    @Operation(summary = "任务模板查询")
    @GetMapping(value = "/v3/private/task/templates")
    ReturnResult<List<TaskTemplateResponse>> queryAll();

    @Operation(summary = "任务模板编辑")
    @PostMapping(value = "/v3/private/task/templates/{id}")
    ReturnResult<?> modify(@RequestHeader("language") String language,
                           @PathVariable Long id,
                           @RequestBody TaskTemplateRequest taskTemplateRequest);


    @Operation(summary = "任务名称多语言查询")
    @GetMapping(value = "/v3/private/task/templates/{id}/contents")
    ReturnResult<List<TaskTemplateLanguageResponse>> queryAllByTitle(@PathVariable Long id);

    @Operation(summary = "任务名称多语言编辑")
    @PostMapping(value = "/v3/private/task/templates/contents/{id}")
    ReturnResult<?> modify(@RequestHeader("language") String language,
                           @PathVariable Long id,
                           @RequestBody TaskTemplateLanguageRequest taskTemplateLanguageRequest);

    @Operation(summary = "任务名称多语言新增")
    @PostMapping(value = "/v3/private/task/templates/{id}/contents")
    ReturnResult<?> add(@RequestHeader("language") String language,
                        @PathVariable Long id,
                        @RequestBody @Valid TaskTemplateLanguageRequest taskTemplateLanguageRequest,
                        BindingResult bindingResult);

}
